import request from "@/apps/admin/units/request"
import {HttpResult, HttpResultData} from "@/types/project";


/**
 * 获取数据类型
 */
export function getDataTypesApi() {
    return request(`/develop/types`)
}


/**
 * 获取数据库和数据表
 */
export function getDataTablesApi() {
    return request(`/develop/data-tables`)
}

/**
 * 获取表详细信息
 */
export function getTableInfoApi<T>(connection: string, table: string): Promise<HttpResultData<T>> {
    return request(`/develop/table-info`, {connection, table})
}

/**
 * 创建代码
 */
export function CreatedCodeApi(data: { [key: string]: any }): Promise<HttpResult> {
    return request(`/develop/created`, data, 'POST')
}